package com.imchen.cms.cmsweb.controller;

import com.imchen.cms.model.CommentsOwnType;
import com.imchen.cms.service.CommentsOwnTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

/**
 * @author imchen
 * @create: 2019-02-03 12:13
 **/

@RestController
@RequestMapping("comments_own_type")
public class ComentsOwnTypeController implements BaseController<CommentsOwnType> {

    @Autowired
    private CommentsOwnTypeService commentsOwnTypeService;

    @Override
    @PostMapping("/add")
    public HashMap add(CommentsOwnType commentsOwnType) throws Exception {
        return commentsOwnTypeService.add(commentsOwnType);
    }

    @Override
    public int remove(int id) {
        return commentsOwnTypeService.removeById(id);
    }

    @Override
    public int delete(int id) {
        return 0;
    }

    @Override
    @RequestMapping("/update")
    public int update(CommentsOwnType commentsOwnType) {
        return commentsOwnTypeService.update(commentsOwnType);
    }

    @Override
    public HashMap<String, Object> find(int id) {
        return commentsOwnTypeService.findByIdToMap(id);
    }
}
